<?php
    include_once('../../src/classes/class.mysql.php');
    
    $comtec_id_responsible = $_GET['id'];
   
    $db = new MySQL();
    
    $texto = "SELECT tag_id_responsible,
		     name,
		     lastname1,
		     lastname2,
		     rut,
		     position,             
                     DATE_FORMAT(company_income_date,'%d/%m/%Y') as income,
                     DATE_FORMAT(birthdate,'%d/%m/%Y') as birth,                        
		     notes,
		     cod_mainteiner
		     FROM responsible 
                     WHERE comtec_id_responsible=".$comtec_id_responsible;
    
    $result = $db->fetch_array($db->query($texto));  
   
    $tag_id_responsible=$result['tag_id_responsible'];
    $name = $result['name'];
    $lastname1 = $result['lastname1'];
    $lastname2 = $result['lastname2'];
    $position  = $result['position'];  
    
    $rut = $result['rut'];   
    $rut_cod = substr($rut, -1, 1);
    $rut = substr($rut,0,strlen($rut)-1);
    
    $income = $result['income'];
    $birth = $result['birth'];
    
    $notes = $result['notes'];
    $cod_mainteiner = $result['cod_mainteiner'];
?>

<fieldset class="curved">
 <legend>Ver</legend>
  <table style="margin: 10px auto; border-spacing: 10px;">
   <tr>
    <td width="200"><label>Tag Id.</label></td>
    <td><input type="text" size="40" DISABLED value="<?=$tag_id_responsible;?>"/></td>
    <td width="200"><label>C&oacute;digo</label></td>
    <td><input type="text" size="40" DISABLED value="<?=$cod_mainteiner;?>"/></td>
   </tr>  
   <tr>
    <td width="200"><label>Rut</label></td>
    <td><input type="text" size="34" DISABLED value="<?=$rut;?>"/>-<input type="text" DISABLED value="<?=$rut_cod;?>" size="1" /></td>
    <td width="200"><label>Nombre</label></td>
    <td><input type="text" size="40" DISABLED value="<?=$name;?>"/></td>
   </tr>
   <tr>
    <td width="200"><label>Apellido Paterno</label></td>
    <td><input type="input" size="40" DISABLED value="<?=$lastname1;?>"/></td>
    <td width="200"><label>Apellido Materno</label></td>
    <td><input type="input" size="40" DISABLED value="<?=$lastname2;?>"/></td>
   </tr>
   <tr>
    <td width="200"><label>Cargo</label></td>
    <td><input type="input" size="40" DISABLED value="<?=$position;?>"/></td>
    <td width="200"><label>Fecha de ingreso</label></td>
    <td><input type="input" size="40" DISABLED value="<?=$income;?>"/></td>
   </tr>
   <tr>    
     <td width="200"><label>Fecha de nacimiento</label></td>
     <td><input type="input" size="40" DISABLED value="<?=$birth;?>"/></td>
   </tr>
   <tr>
    <td width="200">Notas</td>
    </tr>
    <tr>
     <td colspan="4"><textarea rows="3" cols="120" readonly="readonly" style="resize:none"><?=$notes;?></textarea></td>
    </tr>
    <tr><td><input type="button" value="Regresar" onclick="javascript:loadResponsibles();" /></td></tr>
    </table>         
    </fieldset>
